/*
visqrt
Copyright (C) 2010  Bhupendra Aole

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
*/
/*
 * File: Main.java
 * Author: Bhupendra Aole
 * Date: Aug 21, 2010: 
 * 
 * Revisions:
 * ----------
 */

package aole;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

import aole.object.Scene;
import aole.ui.VQApplication;

public class VQMain {
	private static VQApplication app;
	private static Scene scene;
	private static ScriptEngine engine;

	public static void main (String[] args) {
		// text pad for creating scene
		app = new VQApplication();
		// scripting objects
		// create a script engine manager
		ScriptEngineManager factory = new ScriptEngineManager();
		// create a JavaScript engine
		engine = factory.getEngineByName("JavaScript");
		// scene object
		scene = new Scene();
		// expose classes and objects
		try {
			// classes
			engine.eval("importClass(Packages.aole.math.Vec3);");
			engine.eval("importClass(Packages.aole.math.Color3);");

			engine.eval("importClass(Packages.aole.object.CameraPinhole);");
			engine.eval("importClass(Packages.aole.object.PointLight);");
			engine.eval("importClass(Packages.aole.object.Sphere);");
			// objects
			// export scene object in the scripting engine
			engine.put("scene", scene);
		} catch (ScriptException e2) {
			e2.printStackTrace();
		}
		app.display();
	}

	public static VQApplication getApplication () {
		return app;
	}

	public static Scene getScene () {
		return scene;
	}

	public static ScriptEngine getEngine () {
		return engine;
	}
}
